package Application.MapApplication.xmlPrase
{
	import Application.MapApplication.def.Manager;

	public class HomeMapXML
	{
		private var m_data : Object;
		
		public function HomeMapXML()
		{
			
		}
		
		public function prase( ) : void
		{
			m_data = new Object;
			
			var orgXml : XML = Manager.Source.getXML("homeMapDataXML");
			
			m_data["name"] = orgXml.elements("name").text().toString();
			m_data["tileSize"] = int(orgXml.elements("tileSize").text());
			m_data["mapSize"] = int(orgXml.elements("mapSize").text()); 
			m_data["srcFileName"] = orgXml.elements("srcFileName").text().toString();
			
			var dataStr : String = orgXml.elements("boxMapData").text().toString();
			
			var data : Array = dataStr.split(",");
			
			var data2 : Array = [];
			
			m_data["boxMapData"] = data2;
				
			for(var i:int = 0;i< m_data["mapSize"];i++)
			{
				data2[i] = [];
				
				for(var j:int=0;j<m_data["mapSize"];j++)
				{
					data2[i].push(data[j*m_data["mapSize"] + i]);
				}
			}
			
			dataStr =  orgXml.elements("floorMapData").text().toString();
			
			data = dataStr.split(",");
			
			data2 = [];
			
			m_data["floorMapData"] = data2;
			
			for( i = 0;i< m_data["mapSize"];i++)
			{
				data2[i] = [];
				
				for( j =0;j<m_data["mapSize"];j++)
				{
					data2[i].push(data[j*m_data["mapSize"] + i]);
				}
			}
			
		}
		
		public function get Data() : Object
		{
			return m_data;
		}
	}
}